package ua.abihle.aichallenge;

import java.util.Set;

import ua.abihle.basic.Ants;
import ua.abihle.basic.Tile;

public class Util {

	public static Tile findNearestAnt(Tile to, Set<Tile> from, Ants ants){
		Tile result = null;
		int minDist = Integer.MAX_VALUE;
		for(Tile t: from){
			int dist = ants.getDistance(to, t);
			if(dist< minDist){
				minDist = dist;
				result = t;
			}
		}
		return result;
	}
	
}
